package com.huawei.gamebox.service.common.cardkit.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.gamebox.service.common.cardkit.bean.BaseGsCardBean;
import com.huawei.hms.framework.common.ContainerUtils;
import o.cgz;
import o.cii;
import o.Logger;
import o.dof;
import o.evk;
import o.exp$a;
import o.exp$f;

public class BaseGsCard extends cgz {
    private String ॱ;

    public BaseGsCard(Context context) {
        super(context);
    }

    public void ˏ(CardBean cardBean) {
        if (cardBean instanceof BaseGsCardBean) {
            BaseGsCardBean baseGsCardBean = (BaseGsCardBean) cardBean;
            baseGsCardBean.ˋᐝ(ˎ(baseGsCardBean.ॱˌ()));
            baseGsCardBean.ॱ(ˊ(baseGsCardBean));
            this.ˊᐝ = baseGsCardBean;
            super.ˏ(baseGsCardBean);
            return;
        }
        Logger.e("BaseGsCard", "!(data instanceof BaseGsCardBean)");
    }

    private String ˊ(BaseGsCardBean baseGsCardBean) {
        String ॱॱ = baseGsCardBean.ॱॱ();
        Object ʽ = baseGsCardBean.ʽ();
        Object ـॱ = baseGsCardBean.ـॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return ॱॱ;
        }
        if (!ॱॱ.startsWith("html|") && !ॱॱ.startsWith("buoy_html|")) {
            return ॱॱ;
        }
        if (!TextUtils.isEmpty(ʽ)) {
            ॱॱ = ˎ(ॱॱ, "gSource=" + ʽ);
        }
        if (TextUtils.isEmpty(ـॱ)) {
            return ॱॱ;
        }
        return ˎ(ॱॱ, "directory=" + ـॱ);
    }

    private String ˎ(String str) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(ʼ())) {
            return str;
        }
        Object obj = "gscardname=" + ʼ();
        if (str.contains(obj)) {
            return str;
        }
        String str2;
        if (str.indexOf("?") == -1) {
            str2 = str + "?";
        } else {
            str2 = str + ContainerUtils.FIELD_DELIMITER;
        }
        return str2 + obj;
    }

    private String ˎ(String str, String str2) {
        if (str.contains(str2)) {
            return str;
        }
        String str3;
        if (str.indexOf("?") == -1) {
            str3 = str + "?";
        } else {
            str3 = str + ContainerUtils.FIELD_DELIMITER;
        }
        return str3 + str2;
    }

    public String ʼ() {
        return this.ॱ;
    }

    public void ॱ(String str) {
        this.ॱ = str;
    }

    public OnClickListener ʽ() {
        return new OnClickListener(this) {
            final /* synthetic */ BaseGsCard ˏ;

            {
                this.ˏ = r1;
            }

            public void onClick(View view) {
                Object tag = view.getTag();
                if (tag instanceof BaseGsCardBean) {
                    BaseGsCardBean baseGsCardBean = (BaseGsCardBean) tag;
                    if (!dof.ॱ(baseGsCardBean.ॱॱ())) {
                        baseGsCardBean.ॱ(this.ˏ.ˊ(baseGsCardBean));
                        Context context = this.ˏ.ˊˋ.getContext();
                        if (context != null && !cii.ˊ().ˊ(context, baseGsCardBean)) {
                            evk.ˏ(context, exp$f.ͺˎ, 0).ˋ();
                        }
                    }
                }
            }
        };
    }

    protected int ᐝ() {
        return ॱॱ() + this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ);
    }

    protected int ॱॱ() {
        return this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ʿ) * 2;
    }
}
